package cn.javass.dp.command.example6;

/**
 * 厨师的调度
 */
public class CookManager {
    /**
     * 用来控制是否需要创建厨师，如果已经创建就不需要了
     */
    private static boolean runFlag = false;

    public static void runCookManager() {
        if (!runFlag) {
            runFlag = true;
            HotCook cooke1 = new HotCook("张三");
            HotCook cooke2 = new HotCook("李四");
            HotCook cooke3 = new HotCook("王五");

            //启动他们的线程
            Thread t1 = new Thread(cooke1);
            Thread t2 = new Thread(cooke2);
            Thread t3 = new Thread(cooke3);
            t1.start();
            t2.start();
            t3.start();
        }
    }
}
